module.exports = function (success,error){
    const mongoose = require('mongoose')

    const{HOST,PORT,COLLECTION} = require('./options')

    mongoose.connect(`mongodb://${HOST}:${PORT}/${COLLECTION}`)

    mongoose.connection.once('open',function(){
        success()
    })

    mongoose.connection.on('error',function(){
        error()
    })

    mongoose.connection.on('close',function(){
        console.log('断开链接....')
    })
}